import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes: Array<RouteRecordRaw> = [
  {
    path:'/',
    // redirect:'/home/login'
    redirect:'/home'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView,
    redirect:'/home/index',
    children:[
      {
        path: 'position',
        name: 'position',
        component: () => import('../views/Position.vue')
      },
      {
        path: 'aboutus',
        component: () => import('../views/AboutUs.vue')
      },
      {
        path: 'merchant',
        component: () => import('../views/Merchant/Merchant.vue')
      },
      {
        path: 'technician',
        component: () => import('../views/Technician.vue')
      },
      {
        path: '/apps',
        component: () => import('../views/Apps.vue')
      },
      {
        path:'index',
        component:()=>import('../views/index/index.vue')
      },
      {
        path:'detail/:id',
        component:()=>import('../views/detail/Fwxq.vue')
      },
      {
        path:'buy',
        name:'buy',
        component:()=>import('../views/buy/buy.vue')
      },
      {
        path:'serve',
        name:'serve',
        component:()=>import('../views/serve/Serve.vue')  
      },
      {
        path:'search-serve',
        name:"search-serve",
        component:()=>import('../views/serve/SearchServe.vue')
      }
    ]
  },
  {
    path: '/about',
    name: 'about',
    component: () => import('../views/AboutView.vue')
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/Login.vue')
  },
  {
    path: '/register',
    name: 'register',
    component: () => import('../views/Register.vue')
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
